import java.io.*;
import java.lang.*;
import java.util.*;

public class FileUtil {
	private String OSName;
	
	public FileUtil() {
		System.getProperty("os.name");
		
	}
	
	public int mergeFile(String[] flist, String output) {
		// open an output file.
		
		// in a loop, each iteration open a file, read data and output data to output.
		
		// close output file.
		
		return 0;
	}
	
	public ArrayList<String> find(String path) {
		ArrayList<String> fileList = new ArrayList<String>();
		
		try {
			String line;
			String c = "find";
			String cmd = c+" "+path;
			Process p = Runtime.getRuntime().exec(cmd);
			BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
			while((line = buf.readLine()) != null) {
				fileList.add(line);
				System.out.println(line);	//debug
			}		
			
			buf.close();
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return fileList;
	}
	
	public String getOSName() {
		return OSName;
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FileUtil fu = new FileUtil();
		
		
	}

}
